package opn.srn.command.console;

import java.util.Map;

import opn.srn.command.Command;
import opn.srn.command.ICommand;
import opn.srn.event.EventConstants;
import opn.srn.event.IEvent;

public class ConsoleOut extends Command {

	public static final String NAME = "console";

	public ConsoleOut() {
		super(NAME);
	}

	@Override
	public void load(Map<String, String> parameter) throws Exception {
	}

	@Override
	public void onEvent(ICommand<?> source, IEvent event) throws Exception {
		switch (event.getType()) {
		case EventConstants.CMD_START: {
			System.out.println("Command processing started...");
			break;
		}
		case EventConstants.CMD_DATA: {
			Object data = event.getData();
			System.out.println("Data : [" + data + "]");
			break;
		}
		case EventConstants.CMD_FINISH: {
			System.out.println("Command processing finished...");
			break;
		}
		}
		fireEvent(source, event);
	}

}
